<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		
		<link rel="stylesheet" href=" ../../../static/admin/css/formSelects-v4.css"/>
		<link rel="stylesheet" type="text/css" href="../../../static/admin/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="../../../static/admin/css/admin.css" />
		<link rel="stylesheet" type="text/css" href="../../../layui/css/modules/laydate/default/laydate.css" />
		<script type="text/javascript" src="../../../layui/lay/modules/jquery.js"></script>
		<script type="text/javascript" src="../../../layui/lay/modules/laydate.js"></script>
		
	</head>
	<body>
		<div class="wrap-container">
			<form class="layui-form" style="padding-top: 20px;" action='/com.lims/login'>
					<div class="layui-form-item" >
							<div class="layui-inline">
							<label class="layui-form-label">委托单位：</label>
							<div class="layui-input-inline">
								<select name="select"  id="company"  lay-verify="required1" lay-filter="required" lay-search>
									<option></option>
								</select>
							</div>
						</div>
						<div class="layui-inline">
							<label class="layui-form-label">邮编：</label>
							<div class="layui-input-inline">
								<input type="text" name="code"   id="code"  lay-verify="required" placeholder="邮编" autocomplete="off" class="layui-input "  readonly="readonly">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">传真：</label>
							<div class="layui-input-inline">
								<input type="text" name="fax"  id="fax"    lay-verify="required" placeholder="传真" autocomplete="off" class="layui-input"  readonly="readonly">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">地址：</label>
							<div class="layui-input-inline" >
								<input type="text" name="address"   id="address"    lay-verify="required" placeholder="地址" autocomplete="off" class="layui-input "  >
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">联系人：</label>
							<div class="layui-input-inline">
							<select name="contacts" id="contacts"   lay-verify="contacts" lay-search="">
									<option></option>
								</select>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label"  onclick="detection()">检测地点：</label>
							<div class="layui-input-inline">
								 <select name="city" xm-select="example11_1">
       								 <option value="">栽树乘凉</option>
 								   </select>
								</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">地点分类：</label>
							<div class="layui-input-inline">
								<select name="listaddress" lay-verify="required" lay-search="">
									<option>实验室内</option>
									<option>委托方本地</option>
									<option>其它</option>
								</select>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">计划开始日期：</label>
							<div class="layui-input-inline">
								<input id="planbegin"  type="text" name="planbegin"  lay-verify="date" placeholder="请输入计划开始日期" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">计划完成日期：</label>
							<div class="layui-input-inline">
								<input id="planfinish"  type="text" name="planfinish"  lay-verify="date" placeholder="请输入地点完成日期" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">任务来源：</label>
							<div class="layui-input-inline">
								<select name="listaddress" lay-verify="required" lay-search="">
									<option>第三方产品检验</option>
									<option>质检中心纵向检验</option>
									<option>研究性试验</option>
								</select>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">检验来源：</label>
							<div class="layui-input-inline">
								<select name="listaddress" lay-verify="required" lay-search="">
									<option>产品认证</option>
									<option>产品认证复查</option>
									<option>制造特许证</option>
									<option>委托检验</option>
									<option>抽查复查</option>
									<option>特许证复查</option>
									<option>生产许可证</option>
									<option>监督抽查</option>
									<option>研究性检验</option>
									<option>认定检验</option>
									<option>许可证复查</option>
									<option>资质认证</option>
									<option>资质认证复查</option>
									<option>鉴定试验</option>
									<option>专项检验</option>
									<option>专项检验复查</option>
								</select>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">是否给委托方报告：</label>
							<div class="layui-input-inline">
								<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">报告份数：</label>
							<div class="layui-input-inline">
								<input type="text" name="company"  lay-verify="required"  autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">服务方式：</label>
							<div class="layui-input-inline">
								<select name="listaddress" lay-verify="required" lay-search="">
									<option>常规</option>
									<option>加急</option>
									<option>特急</option>
								</select>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">取报告方式：</label>
							<div class="layui-input-inline">
								<select name="listaddress" lay-verify="required" lay-search="">
									<option>邮寄</option>
									<option>自取</option>
									<option>其它</option>
								</select>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">样品预计到达日期：</label>
							<div class="layui-input-inline">
								<input id="arrivedate"  type="text" name="arrivedate"  lay-verify="date" placeholder="请输入样品预计到达日期" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">受理人：</label>
							<div class="layui-input-inline">
								<input type="text" name="company"  lay-verify="required" placeholder="请输入受理人" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">检验单位：</label>
							<div class="layui-input-inline">
								<select name="listaddress" lay-verify="required" lay-search="">
									<option>暂无数据</option>
								</select>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">任务名称：</label>
							<div class="layui-input-inline">
								<input type="text" name="company"  lay-verify="required" placeholder="请输入任务名称" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">授权签字领域：</label>
							<div class="layui-input-inline">
								<select name="listaddress" lay-verify="required" lay-search="">
									<option>机车车辆装置</option>
									<option>列车运行安全监控记录装置</option>
									<option>机车转速传感器</option>
								</select>
							</div>
						</div>
						
						<div class="layui-form-item layui-form-text">
							<label class="layui-form-label">双方约定的技术要求</label>
							<div class="layui-input-block" >
								<textarea   lay-verify="required" name="reson" placeholder="请输入双方约定的技术要求" class="layui-textarea"></textarea>
							</div>
						</div>
						
						<div class="layui-form-item layui-form-text">
							<label class="layui-form-label">客户其它要求</label>
							<div class="layui-input-block">
								<textarea   lay-verify="required" name="reson" placeholder="请输入客户其它要求" class="layui-textarea"></textarea>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">试验报告盖章要求：</label>
							<div class="layui-input-inline" >
								<input type="text" name="outside" required lay-verify="required" placeholder="请输入外来人员" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">CNAS：</label>
							<div class="layui-input-inline">
								<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">CMA：</label>
							<div class="layui-input-inline">
								<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
							</div>
						</div>
						
						<div class="layui-form-item layui-form-text">
							<label class="layui-form-label">备注：</label>
							<div class="layui-input-block" >
								<textarea   lay-verify="required" name="reson" placeholder="请输入备注" class="layui-textarea"></textarea>
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">是否将备注中的内容写到检验协议合同：</label>
							<div class="layui-input-inline">
								<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">是否与委托方签订安全协议：</label>
							<div class="layui-input-inline">
								<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">项目工作令号：</label>
							<div class="layui-input-inline">
								<input type="text" name="company"  lay-verify="required" placeholder="请输入项目工作令号" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">项目名称：</label>
							<div class="layui-input-inline">
								<input type="text" name="company"  lay-verify="required" placeholder="请输入项目名称" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<div class="layui-inline">
							<label class="layui-form-label">项目负责人：</label>
							<div class="layui-input-inline">
								<input type="text" name="company"  lay-verify="required" placeholder="请输入负责人" autocomplete="off" class="layui-input">
							</div>
						</div>
						
						<!-- 选项卡页面 -->
						
						<hr class="layui-bg-cyan" style="margin-top:40px;">
						
						<div class="layui-tab page-content-wrap">
							<ul class="layui-tab-title">
								<li class="layui-this">样品信息</li>
								<li>检测信息</li>
							</ul>
							<!-- 选项卡内容 -->
							<div class="layui-tab-content">
							<!-- 选项卡第一页样品信息 -->
								<div class="layui-tab-item layui-show">
								
									<div class="layui-inline">
										<label class="layui-form-label">样品名称：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入样品名称" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">样品数量：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入样品数量" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">样品单位：</label>
										<div class="layui-input-inline">
											<select name="listaddress" lay-verify="required" lay-search="">
												<option>个</option>
												<option>台</option>
												<option>把</option>
											</select>
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">商标/标识：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入商标/标识" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">生产单位：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入制造（生产）单位" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">样品类型：</label>
										<div class="layui-input-inline">
											<select name="listaddress" lay-verify="required" lay-search="">
												<option>机车车辆电子装置</option>
												<option>机车用直流电机</option>
											</select>
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">型号规格：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入型号规格" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">生产日期/批：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入生产日期/批" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">出厂编号：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入出厂编号" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">送样人：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入送样人" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">图号/物资编码：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入图号/物资编码" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">公司项目名称：</label>
										<div class="layui-input-inline">
											<select name="listaddress" lay-verify="required" lay-search="">
												<option>机车车辆电子装置</option>
												<option>机车用直流电机</option>
											</select>
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">检后处理：</label>
										<div class="layui-input-inline">
											<select name="listaddress" lay-verify="required" lay-search="">
												<option>机车车辆电子装置</option>
												<option>机车用直流电机</option>
											</select>
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">抽样日期：</label>
										<div class="layui-input-inline">
											<input id="arrivedate"  type="text" name="arrivedate"  lay-verify="date" placeholder="请输入抽样日期" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">样品来源：</label>
										<div class="layui-input-inline">
											<select name="listaddress" lay-verify="required" lay-search="">
												<option>送样</option>
												<option>抽样</option>
											</select>
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">项目工作号：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入项目工作号" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">生产序列号：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入项目工作号" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">保密要求：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入项目工作号" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">样品附件：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入项目工作号" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">抽样方案/判定依据：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入项目工作号" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">样品状态说明：</label>
										<div class="layui-input-inline">
											<input type="text" name="company"  lay-verify="required" placeholder="请输入项目工作号" autocomplete="off" class="layui-input">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">未见明显的外观缺陷：</label>
										<div class="layui-input-inline">
											<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">外观未见明显异常，性能待查：</label>
										<div class="layui-input-inline">
											<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
										</div>
									</div>
									
									<div class="layui-inline">
										<label class="layui-form-label">设置为空值：</label>
										<div class="layui-input-inline">
											<input type="checkbox" name="company"  lay-skin="switch"  lay-text="是|否">
										</div>
									</div>
												
												
												
								</div>
								<!-- 第一页样品信息--结束 -->
								
								
								<!-- 选项卡第二页检测信息 -->
								<div class="layui-tab-item">
								
									<div class="layui-inline">
											<label class="layui-form-label">测试计划组：</label>
											<div class="layui-input-inline">
												<select name="listaddress" lay-verify="required" lay-search="">
													<option>实验一部</option>
													<option>实验二部</option>
													<option>实验四部</option>
													<option>实验五部</option>
												</select>
											</div>
									</div>
									
									<div class="layui-inline">
											<label class="layui-form-label">依据标准：</label>
											<div class="layui-input-inline">
												<select name="listaddress" lay-verify="required" lay-search="">
													<option>EN 50121-1:2017</option>
													<option>TJ 45874-3:2018</option>
													<option>GB 42398-1:2017</option>
												</select>
											</div>
									</div>		
								
								
								</div>
								<!-- 选项卡第二页检测信息--结束 -->
							</div>
						</div>
						
					</div>
					<!-- 页面结束 -->
					
				</form>
		</div>
		<script src="../../../static/admin/js//formSelects-v4.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../static/admin/js/jQuery-v3.3.1.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../../static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script>
		//储存委托单位信息
		var companyInfo;
		//储存选择单位信息
		var rasclientid;
		//检测地点输入框监听
		function detection(){
			//iframe层-父子操作
			layer.open({
			  type: 2,
			  area: ['700px', '450px'],
			  fixed: false, //不固定
			  maxmin: true,
			  content: '/web/admin/lims/locationDetection:.html'
			});
		}
		//重新渲染表单
		function renderForm(){
		 layui.use('form', function(){
		 var form = layui.form();//高版本建议把括号去掉，有的低版本，需要加()
		 layui.form('select').render();
		 });
		 }
		//获取联系人信息
		function getContacts(){
			$.ajax({
				type:"GET",
				url:"/web/consulting",
				datatye:"json",
				data:{status:"contacts",rasclientid:rasclientid},
				success:function(data){
					var value = eval('('+data+')');
					console.log(value.contacts[0].text);
					for (var i=0;i<value.contacts.length;i++)
					{
					    //为select添加option
					    $("#contacts").append("<option value="+value.contacts[i].text+">"+value.contacts[i].text+"</option>"); 
					}
				    renderForm();//表单重新渲染，要不然添加完显示不出来新的option
				},
				error:function(err){
					console.log(err.status)
				}
			})
		 }
		
			layui.use(['form','element'], function() {
				var form = layui.form();
				var element = layui.element();
				form.render();
				//监听提交
				form.on('submit(formDemo)', function(data) {
					layer.msg(JSON.stringify(data.field));
					return false;
				});
				//委托单位下拉框监听
				  form.on('select(required)', function(data){
					for (var i=0;i<companyInfo.length;i++){
						if(data.value==companyInfo[i].compname){
							rasclientid=companyInfo[i].rasclientid;
							getContacts();
							
							<!-- 赋值 -->
							$("#code").val(companyInfo[i].zip);
							$("#fax").val(companyInfo[i].primaryfax);
							$("#address").val(companyInfo[i].adress);
							break;
						}
					}
				  });
			});
			
			laydate.render({
				  elem: '#planbegin',
				  type: 'datetime'
				})
			laydate.render({
				  elem: '#planfinish',
				  type: 'datetime'
				})
			laydate.render({
				  elem: '#arrivedate',
				  type: 'datetime'
				})
				$.ajax({
					type:"GET",
					url:"/web/consulting",
					datatye:"json",
					data:{status:"company"},
					success:function(data){
						var value = eval('('+data+')');
						console.log(value.company[0].compname);
						companyInfo=value.company;
						for (var i=0;i<value.company.length;i++)
						{
						    //为select添加option
						    $("#company").append("<option value="+value.company[i].compname+">"+value.company[i].compname+"</option>"); 
						}
					    renderForm();//表单重新渲染，要不然添加完显示不出来新的option
					},
					error:function(err){
						console.log(err.status)
					}
				})
				
		</script>
	</body>

</html>